<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <title>{% block title %}Jumph{% endblock %}</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>

        {% block stylesheets %}
            {% stylesheets filter='cssrewrite'
                '%kernel.root_dir%/../vendor/components/bootstrap/dist/css/bootstrap.css'
                '%kernel.root_dir%/../vendor/components/fontawesome/css/font-awesome.css'
                '%kernel.root_dir%/../vendor/components/admin-lte/css/AdminLTE.css'
                '%kernel.root_dir%/../vendor/components/bootstrap-datepicker/css/datepicker3.css'
                '@JumphAppBundle/Resources/public/css/jumph.css'
            %}
                 <link rel="stylesheet" href="{{ asset_url }}" />
            {% endstylesheets %}
        {% endblock %}
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
    </head>

    <body class="skin-blue">
        <header class="header">
            <a href="{{ path('jumph_dashboard_overview') }}" class="logo">
                Jumph
            </a>
            <nav class="navbar navbar-static-top" role="navigation">
                <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <div class="navbar-right">
                    <ul class="nav navbar-nav">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="fa fa-user"></i>
                                <span>{{ app.getUser().getName() }} <i class="caret"></i></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="{{ path('fos_user_profile_edit') }}" class="btn btn-default btn-flat">Profile</a></li>
                                <li><a href="{{ path('fos_user_change_password') }}" class="btn btn-default btn-flat">Change password</a></li>
                                <li><a href="{{ path('fos_user_security_logout') }}" class="btn btn-default btn-flat">Sign out</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <aside class="left-side sidebar-offcanvas">
                <section class="sidebar">
                    <form action="#" method="get" class="sidebar-form">
                        <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="Search..."/>
                            <span class="input-group-btn">
                                <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </form>
                    {{ knp_menu_render('JumphAppBundle:Builder:sideMenu', {'currentClass' : 'active'} ) }}
                </section>
            </aside>

            <aside class="right-side">
                <section class="content-header">
                    {% block headerContent %}

                    {% endblock %}
                </section>

                <section class="content">
                    {% include '::alerts.html.twig' with { 'close': true } %}

                    {% block content %}
                    {% endblock %}
                </section>
            </aside>
        </div>
        {% block javascripts %}
            {% javascripts
                '%kernel.root_dir%/../vendor/components/jquery/dist/jquery.min.js'
                '%kernel.root_dir%/../vendor/components/bootstrap/dist/js/bootstrap.min.js'
                '%kernel.root_dir%/../vendor/components/admin-lte/js/AdminLTE/app.js'
                '%kernel.root_dir%/../vendor/components/bootstrap-datepicker/js/bootstrap-datepicker.js'
            %}
                <script src="{{ asset_url }}"></script>
            {% endjavascripts %}
            <script type="text/javascript">
                var createForm = function (action, data) {
                    var $form = $('<form action="' + action + '" method="POST"></form>');
                    for (input in data) {
                        if (data.hasOwnProperty(input)) {
                            $form.append('<input name="' + input + '" value="' + data[input] + '">');
                        }
                    }

                    return $form;
                };

                $(document).on('click', 'a.js-delete-item', function (e) {
                    e.preventDefault();
                    var $this = $(this);

                    var $form = createForm($this.attr('href'), {
                        _method: 'DELETE'
                    }).hide();

                    $('body').append($form); // Firefox requires form to be on the page to allow submission
                    $form.submit();
                });
            </script>
        {% endblock %}
    </body>
</html>
